package com.future.lock.home.activity;

import android.graphics.Color;
import android.os.Bundle;
import android.view.View;

import com.future.baselib.activity.BaseActivity;
import com.future.lock.R;
import com.future.lock.common.Constants;
import com.jaeger.library.StatusBarUtil;

import java.util.Timer;
import java.util.TimerTask;

import butterknife.ButterKnife;
import butterknife.OnClick;

public class LockOpeningActivity extends BaseActivity {

    private int position;

    @Override
    protected void initContentView(Bundle savedInstanceState) {
        setContentView(R.layout.activity_lock_opening);
        ButterKnife.bind(this);
    }

    @Override
    protected void initView() {
        StatusBarUtil.setColor(this, Color.parseColor("#4A566D"));
        new Timer().schedule(new TimerTask() {
            @Override
            public void run() {
                runOnUiThread(() -> {
                    finish();
                    overridePendingTransition(R.anim.open_lock_in,R.anim.open_lock_out);
                });
            }
        },3000);
    }

    @Override
    protected void initLogic() {

    }

    @Override
    protected void getBundleExtras(Bundle extras) {
        position = extras.getInt("position",0);
    }

    @OnClick({R.id.layout_open_lock_notes, R.id.layout_people_manage})
    public void onViewClicked(View view) {
        Bundle bundle = new Bundle();
        bundle.putString("lock_id", Constants.lockList.get(position).lock_id);
        bundle.putString("lock_name",Constants.lockList.get(position).lock_name);
        switch (view.getId()) {
            case R.id.layout_open_lock_notes://开锁记录
                startActivity(LockNotesActivity.class,bundle);
                break;
            case R.id.layout_people_manage://成员管理
                startActivity(PeopleManageActivity.class,bundle);
                break;
        }
    }
}
